class TicketsController < ApplicationController
  before_filter :login_required
  
  def index
    redirect_to :action=>:list
  end

  def list
    store_location
    @ticket_pages, @tickets = paginate :tickets, :per_page=>20, :order=>"vto ASC"
    @page, @lnk_from, @lnk_to = numeros_pagina @ticket_pages
  end
  
  def edit
    @ticket = Ticket.find(params[:id])
  end
  
  def update
    @ticket = Ticket.find(params[:id])
    if @ticket.update_attributes(params[:ticket])
      flash[:success] = 'Ticket actualizado.'
      redirect_back_or_default :action => 'show', :controller=>'plans', :id => @ticket.plan
    else
      render :action => 'edit'
    end
  end

end
